<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>主页示例</title>
    <script type="text/javascript" src="js/xhr.js"></script>

    <style>
        /*兼容浏览器*/
        * {
            padding: 0;
            margin: 0;
        }

        .head-title {
            width: 100%;
            height: 120px;
            background-color: #415380;
            position: relative;
        }

        .head-title>img {
            position: absolute;
            top: 30px;
            left: 30px;
            width: 60px;
            height: 60px;
        }

        .head-title>h2 {
            position: absolute;
            left: 120px;
            top: 20px;
            color: #fff;
        }

        .head-title>h1 {
            position: absolute;
            right: 50px;
            top: 20px;
            color: #fff;
        }

        .head-title>h4 {
            position: absolute;
            left: 120px;
            top: 60px;
            color: #fff;
        }

        .seg {
            width: 100%;
            height: 5px;
            background-color: #F96B00;
        }

        .bottom {
            width: 100%;
            height: 100px;
            background-color: #415380;
            position: relative;
        }

        .bottom>h3 {
            position: absolute;
            left: 700px;
            top: 30px;
            color: #ffffff;
        }

        .bottom>a {
            position: absolute;
            left: 950px;
            top: 30px;
            text-decoration: none;
            color: #fff;
        }

        .content {
            width: 100%;
            height: 605px;
        }

        .content-left {
            width: 15%;
            height: 605px;
            font-family: "Roboto", sans-serif;
            background-color: #BFBFBF;
            float: left;
            box-shadow: 0 4px 40px -8px rgba(0, 0, 0, 0.2);
        }

        .content-middle {
            width: 80%;
            background-color: white;
            text-align: center;
            text-transform: uppercase;
        }

        .middle-title>h2 {
            position: absolute;
            left: 820px;
            top: 150px;
            color: black;
        }

        .content-middle {
            width: 80%;
            background-color: white;
            text-align: center;
            text-transform: uppercase;
        }

        .content-right {
            width: 85%;
            height: 605px;
            background-color: #ffffff;
            float: right;
        }

        .left-title {
            height: 45px;
            width: 100%;
            background-color: #415380;
        }

        .left-title>a {
            display: block;
            width: 100%;
            height: 45px;
            text-align: center;
            line-height: 40px;
            color: #ffffff;
            text-decoration: none;
        }

        .content-left>.tabs {
            width: 100%;
            height: 100%;
            background-color: #415380;
            color: #fff;
            text-transform: uppercase;
            text-align: center;
        }



        .content-left>.tabs>.tab {
            width: 100%;
            height: 60px;
            border: 1px solid #415380;
            background-color: #F96B00;
            cursor: pointer;
            font-weight: bold;
            line-height: 60px;
        }

        .content-left>.tabs>.tab:hover {
            color: #415380;
        }
    </style>
</head>

<body onload="init()">
    <div class="head-title">
        <h2>华清远见教育集团</h2>
        <h1>秉承做良心教育</h1>
        <h4>济南研发中心</h4>
    </div>
    <div>
        <div class="seg"></div>
        <div class="content">

            <div class="content-left">
                <div class="left-title">
                    <a href="temp_index.html">系统信息</a>
                </div>
                <div class="tabs">
                    <div class="tab"><a href="temp_STM32.html">STM32设备</a><br></div>
                    <div class="tab"><a href="temp_modbus.html">ModBus设备</a><br></div>
                    <div class="tab"><a href="http://192.168.1.110:8080/stream_simple.html">监控画面</a><br></div>
                </div>
            </div>


            <div class="content">
                <div class="middle-title>">
                    <h2 style="text-align: center;">系 统 信 息 </h2>
                </div>
                <div>
                    <table class="content-middle">

                        <tr>
                            <td>
                                <h3>主 机 名</h3>
                            </td>
                            <td>
                                <h3> linux </h3>
                            </td>
                        </tr>
                        <tr>
                            <td>固件版本</td>
                            <td><input type="text" value="V0.0" id="version"
                                    style="border:none;width: 50px;height: 30px"></td>
                        </tr>
                        <tr>
                            <td>本地时间</td>
                            <td><input type="text" value="00:00" id="Main" name="Main"
                                    style="border:none;width: 150px;height: 30px;"></td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
    </div>

    <div class="seg"></div>
    <div class="bottom">
        <h3>北京华清远见教育集团</h3>
        <a href="http://m.hqyj.com">http://m.hqyj.com </a>
    </div>
</body>
<script type="text/javascript">
    function init() {
        refresh();
        //today();
    }
    function refresh() {
        var post_req = {
            "type": 3,
        };

        XHR.post('cgi-bin/web.cgi', JSON.stringify(post_req), function (x, info) {
            console.log('data = ', info.version)

            document.getElementById("version").value = info.val;
            
        });
    }
    function today() {
        //获取当前时间
        var today = new Date();
        var h = today.getFullYear();
        var m = today.getMonth() + 1;
        var d = today.getDate();
        var hours = today.getHours();
        var minutes = today.getMinutes();
        var seconds = today.getSeconds();
        m = m < 10 ? "0" + m : m; //  这里判断月份是否<10,如果是在月份前面加'0'
        d = d < 10 ? "0" + d : d; //  这里判断日期是否<10,如果是在日期前面加'0'
        minutes = minutes < 10 ? "0" + minutes : minutes;
        seconds = seconds < 10 ? "0" + seconds : seconds;
        return h + "-" + m + "-" + d + " " + hours + ":" + minutes + ":" + seconds;
    }
    setInterval(()=>{
        document.getElementById("Main").value = today();
    },1000)
</script>

</html>